package com.ruoyi.web.controller.EsSearch;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 员工实体类
 * @Document：作用在类上，标记实体类为文档对象。 indexName（索引名称，相当于数据库的表名称）
 * @Id：作用在成员变量上，标记一个字段作为id主键。 在Elasticsearch中，文档ID是唯一的，用于标识文档。
 * @Field：定义Java对象属性与Elasticsearch文档字段之间的映射关系。
 * @author
 */
@Data
@Document(indexName = "employee_info")
public class EmployeeInfo {

    @Id
    private Long id;

    /**
     * 工号
     */
    @Field(name = "job_no")
    private String jobNo;

    /**
     * 姓名
     */
    @Field(name = "name")
    private String name;

    /**
     * 英文名
     */
    @Field(name = "english_name")
    private String englishName;

    /**
     * 工作岗位
     */
    private String job;

    /**
     * 性别
     */
    private Integer sex;

    /**
     * 年龄
     */
    private Integer age;

    /**
     * 薪资
     */
    private BigDecimal salary;

    /**
     * 入职时间
     */
    @Field(name = "job_day", format = DateFormat.date_time)
    private Date jobDay;

    /**
     * 备注
     */
    private String remark;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getJobNo() {
        return jobNo;
    }

    public void setJobNo(String jobNo) {
        this.jobNo = jobNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEnglishName() {
        return englishName;
    }

    public void setEnglishName(String englishName) {
        this.englishName = englishName;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public BigDecimal getSalary() {
        return salary;
    }

    public void setSalary(BigDecimal salary) {
        this.salary = salary;
    }

    public Date getJobDay() {
        return jobDay;
    }

    public void setJobDay(Date jobDay) {
        this.jobDay = jobDay;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public EmployeeInfo() {
    }

    public EmployeeInfo(Long id, String jobNo, String name, String englishName, String job, Integer sex, Integer age, BigDecimal salary, Date jobDay, String remark) {
        this.id = id;
        this.jobNo = jobNo;
        this.name = name;
        this.englishName = englishName;
        this.job = job;
        this.sex = sex;
        this.age = age;
        this.salary = salary;
        this.jobDay = jobDay;
        this.remark = remark;
    }

    @Override
    public String toString() {
        return "EmployeeInfo{" +
                "id=" + id +
                ", jobNo='" + jobNo + '\'' +
                ", name='" + name + '\'' +
                ", englishName='" + englishName + '\'' +
                ", job='" + job + '\'' +
                ", sex=" + sex +
                ", age=" + age +
                ", salary=" + salary +
                ", jobDay=" + jobDay +
                ", remark='" + remark + '\'' +
                '}';
    }
}

